#include <iostream>

using namespace std;

int main_0025(void)
{
    int num = 0;
    cin >> num;

    int gold = 0;
    int silver = 0;
    int copper = 0;

    int a, b, c;
    for (int i = 0; i < num; ++i) {
        cin >> a >> b >> c;
        gold += a;
        silver += b;
        copper += c;
    }

    cout << gold << " "
         << silver << " "
         << copper << " "
         << gold + silver + copper;

    return 0;
}
